package cn.maszy.action.customer;

import org.springframework.beans.factory.annotation.Autowired;

import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.customer.B_T_Ufp_ContractWord;
import cn.maszy.service.customer.B_T_Ufp_ContractWordService;

public class ContactAction extends BaseAction<B_T_Ufp_ContractWord> {

	/**
	 * 版本号
	 */
	private static final long serialVersionUID = 1L;
	private B_T_Ufp_ContractWord b_T_Ufp_ContractWord;
	@Autowired
	private B_T_Ufp_ContractWordService b_T_Ufp_ContractWordService;
	private String checkIds;
	private String customerUuid;
	private Pager<B_T_Ufp_ContractWord> Pagers;
	/*********************class set/get****************************/
	public B_T_Ufp_ContractWord getB_T_Ufp_ContractWord() {
		return b_T_Ufp_ContractWord;
	}
	public void setB_T_Ufp_ContractWord(B_T_Ufp_ContractWord b_T_Ufp_ContractWord) {
		this.b_T_Ufp_ContractWord = b_T_Ufp_ContractWord;
	}
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	public String getCustomerUuid() {
		return customerUuid;
	}
	public void setCustomerUuid(String customerUuid) {
		this.customerUuid = customerUuid;
	}
	
	public Pager<B_T_Ufp_ContractWord> getPagers() {
		return Pagers;
	}
	public void setPagers(Pager<B_T_Ufp_ContractWord> pagers) {
		Pagers = pagers;
	}
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 页面查询
	 * @return
	 * @throws Exception
	 */
	public String contactList() throws Exception {
		String uuid="";
		if(b_T_Ufp_ContractWord!=null){
			uuid=b_T_Ufp_ContractWord.getCustomerUuid();
		}
//		pager = new Pager<B_T_Ufp_ContractWord>(pageNum, numPerPage,orderField,orderDirection);
//		pager= b_T_Ufp_ContractWordService.selectList(b_T_Ufp_ContractWord,pager,uuid);
		Pagers = new Pager<B_T_Ufp_ContractWord>(pageNum, numPerPage,orderField,orderDirection);
		Pagers = b_T_Ufp_ContractWordService.selectList(b_T_Ufp_ContractWord,Pagers,uuid);
		return SUCCESS;
	}
	/**
	 * 新增更新
	 * @return
	 * @throws Exception
	 */
	public String contactUpdate() throws Exception {
		int i	=b_T_Ufp_ContractWordService.update(b_T_Ufp_ContractWord);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "jbsxBox", "closeCurrent", "customer/contactList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "CostomerDetailReade","jbsxBox", "closeCurrent", "costomer/CostomerDetailReade?b_T_Ufp_Customer.uuid="+b_T_Ufp_ContractWord.getCustomerUuid());
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 删除一条数据
	 * @return
	 * @throws Exception
	 */
	public String contactDel() throws Exception {
		int i=b_T_Ufp_ContractWordService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "contactList","", "forward", "");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 查询一条数据
	 * @return
	 * @throws Exception
	 */
	public String contactDetail() throws Exception {
		if(b_T_Ufp_ContractWord == null){
			b_T_Ufp_ContractWord=b_T_Ufp_ContractWordService.selectOne("");
			b_T_Ufp_ContractWord.setCustomerUuid(customerUuid);
		}else{
			b_T_Ufp_ContractWord=b_T_Ufp_ContractWordService.selectOne(b_T_Ufp_ContractWord.getContractId());
		}
		return SUCCESS;
	}
	
}
